package com.example.demo.task;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.log4j.Logger;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class TestTask {
	private Logger log=Logger.getLogger(TestTask.class);
	private int i;

	@Scheduled(fixedDelay=1000)
	public void say(){
		System.out.println("高兴"+i+"-----["+new SimpleDateFormat("yyyy-MM:dd HH:mm:ss").format(new Date())+"]");
		i++;
		log.info("高兴");
	}
}
